#ifndef USER_GlOBAL_H
#define USER_GlOBAL_H
//user_global defines ()
#include "gd32f30x.h"
#include<math.h>


//user_def
#define XDATA __attribute__((section("XRAM")))
#define xdata __attribute__((section("XRAM")))
#define IDATA __attribute__((section("DTCM")))
#define XDATA __attribute__((section("XRAM")))

#ifndef   bit
  #define bit  unsigned char
#endif
#ifndef   uchar
  #define uchar  unsigned char
#endif
#ifndef   ushort
  #define ushort unsigned short
#endif
#ifndef   ulong
  #define ulong unsigned long
#endif
#ifndef   uint
  #define uint unsigned long
#endif


#ifndef   u8
  #define u8  unsigned char
  #define U8  unsigned char
#endif
#ifndef   u16
  #define u16 unsigned short
  #define U16 unsigned short
#endif
#ifndef   u32
  #define u32 unsigned long
  #define U32 unsigned long
#endif


//#define UNUSED(x)        ((x)=(x))
#ifndef _STR
#define __STR(x)        #x
#define _STR(x)          __STR(x)
#endif

#ifndef assert
#define assert(expr)
#endif

typedef union tagUU16
{
    U8 UU8[2];
    U16 UU16;
} UU16;


#define USE_BY_USART1
//------------------------------------------------------------------------------
// 常量定义
//------------------------------------------------------------------------------

// 系统频率
#define SYSCLK              INTCLK

//#define UNUSED(x)    ((x)=(x))

#define max(a, b)    ((a) > (b) ? (a) : (b))
#define min(a, b)    ((a) < (b) ? (a) : (b))

#define TIMER_STOPED   0xFFFFFFFF
//------------------------------------------------------------------------------
// 数据类型
//------------------------------------------------------------------------------

typedef ushort Route;

#define MSB        1
#define LSB        0

typedef struct FILE_DESC
{
  ushort mask;
  ushort count;
  union
  {
    ushort *w;
    float *f;
  } ptr;
} FILE_DESC;

#endif // CONFIG_H
